package com.hoongs.v1.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hoongs.v1.utils.DateUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Repository;

import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Repository
@TableName(value = "address")
public class Address {

    @TableId(type = IdType.ASSIGN_UUID)
    private String id;

    private String gender = "0"; // 性别信息 1:男 2:女 0:保密

    private String name;

    private String mobile;

    private String address;

    @TableField(value = "address_detail")
    private String addressDetail;

    private String tag;         // 地址标签

    @TableField(value = "tag_dict_value")
    private String tagDictValue;


    @TableField(value = "user_id")
    private String userId;

    @JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;       // 发布时间

    @JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
    @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;    // 更新时间

}
